BEGPIOD_VERSION = 1.0
BEGPIOD_SITE = https://gitee.com/aleeshadow/begpiod.git
BEGPIOD_SITE_METHOD = git
BEGPIOD_INSTALL_TARGET = YES

define BEGPIOD_BUILD_CMDS
	$(TARGET_MAKE_ENV) CROSS_COMPILE=$(TARGET_CROSS) \
		CC="$(TARGET_CC)" \
		$(MAKE) -C $(@D) \
		CFLAGS="$(TARGET_CFLAGS)" $(BEGPIOD_BUILD_TARGET)
endef

define BEGPIOD_INSTALL_TARGET_CMDS
	$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/local/sbin
	$(INSTALL) -m 0755 $(@D)/begpiod $(TARGET_DIR)/usr/local/sbin/begpiod
	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc
	$(INSTALL) -d -m 0755 $(TARGET_DIR)/etc/init.d
	$(INSTALL) -m 0755 $(BEGPIOD_PKGDIR)etc/init.d/S11begpiod $(TARGET_DIR)/etc/init.d/S11begpiod
endef

$(eval $(generic-package))